<?php
/*
* db.php
* interface for database
* yc@2009-10-19
*/

interface Db{

    //@return bool
    public function connect(/*$user, $pass, $dbName = null, $host = null*/);
    //
    public function close();
    //@return raw query
    public function query($sql);
    //$data must bu explict type, eg: array(1, '1')
    //@return bool
    public function insert($table, $data = array());
    //@return int
    public function lastInsertId();
    //@return bool
    public function update($table, $data = array(), $where = '1=0');
    //@return bool
    public function delete($table, $where = '1=0');
    //@return string||number
    public function fetchResult($table, $what, $where = '1=0');
    //@return Array
    public function fetchRow($table, $where);
    //@return Array of Array
    public function fetchAll($sql);
    //@return Array of Array
    public function fetchAssoc($sql);
    //@return Array of Array
    public function fetchArray($sql);
}
?>
